<?php
	$data = array();
	$data['title'] = "Tìm kiếm";
	$db = new Model_msearch;
	@$key = $_POST['key'];
	$data['cate'] = $db->list_cate();
	//$data['search'] = $db->search($key);
	//debug($data['search']);
	$pager = new libraries_pager;
	$pager->set_link("index.php?page=search");
	$limit = 16;
	$total = $db->total_pro($key);
	//debug($total);
	$start = $pager->start();
	$pages = $pager->page($total,$limit);
	$data['pagelist'] = $pager->listpage($pages,$start,$limit);
	$data['list_pro'] = $db->search($key,$start,$limit);
	$data['template'] = "main_home/search_view";
	loadview("layout",$data);
?>